package com.zoe.app;

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author Zoe.Zhang
 * @date 2022/01/18
 * @description
 */
@Component
// 默认情况下,Test0优先于Test1加载,所以在调用Test1的数据的时候,Test1还没有初始化完成,
// 所以需要DependsOn指定Test0的加载 依赖于Test1,需要先加载Test1才行
// https://blog.csdn.net/weixin_43591980/article/details/121547379?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.pc_relevant_default&spm=1001.2101.3001.4242.1&utm_relevant_index=3
@DependsOn("test1")
public class Test0 implements BeanPostProcessor {
    @PostConstruct
    public void init() {
        System.out.println(Test1.WORLD);
    }

    public Test0() {
        System.out.println(Test1.HELLO);
    }
}
